package 第七周.experiment;

import org.junit.Test;
import org.junit.Before;
import org.junit.After;

import static junit.framework.TestCase.assertEquals;

/**
 * MyUtil Tester.
 *
 * @author <Authors name>
 * @since <pre>���� 18, 2018</pre>
 * @version 1.0
 */
public class MyUtilTest {

    @Before
    public void before() throws Exception {
    }

    @After
    public void after() throws Exception {
    }

    /**
     *
     * Method: percentage2fivegrade(int grade)
     *
     */
    @Test
    public void testPercentage2fivegrade() throws Exception {
//TODO: Test goes here...
        assertEquals("不及格", MyUtil.percentage2fivegrade(55));
        assertEquals("及格", MyUtil.percentage2fivegrade(65));
        assertEquals("中等", MyUtil.percentage2fivegrade(75));
        assertEquals("良好", MyUtil.percentage2fivegrade(85));
        assertEquals("优秀", MyUtil.percentage2fivegrade(95));
    }
    @Test
    public void testException(){
        assertEquals("错误", MyUtil.percentage2fivegrade(-50));
        assertEquals("错误",MyUtil.percentage2fivegrade(190));
    }


    @Test
    public void testBoundary(){
        assertEquals("错误",MyUtil.percentage2fivegrade(0));
        assertEquals("及格",MyUtil.percentage2fivegrade(60));
        assertEquals("中等",MyUtil.percentage2fivegrade(70));
        assertEquals("良好",MyUtil.percentage2fivegrade(80));
        assertEquals("优秀",MyUtil.percentage2fivegrade(90));
        assertEquals("优秀",MyUtil.percentage2fivegrade(100));
    }
}




